import {Component, OnInit} from '@angular/core';

import {FormGroup, FormBuilder, Validators, FormControl, FormsModule, ReactiveFormsModule} from '@angular/forms';
import {Login} from './login.model';


@Component({
  selector: 'app-login',
  templateUrl: './login.component.html',
  styleUrls: ['./login.component.css']
})


export class LoginComponent implements OnInit {

  loginForm: FormGroup;

  /*标题*/
  title = '用户登录';

  /*登录数据实体*/
  loginModel: Login = {
    loginName: '',
    passWord: ''
  };


  constructor(private  fb: FormBuilder) {
    this.loginForm = this.fb.group({
      loginName: ['', [Validators.required]],
      password: ['', [Validators.required]]
    });
  }


  /*登录事件*/
  onClickLogin() {
    alert('sdsf');
  }


  ngOnInit() {
   // this.loginForm = new FormGroup({loginName: new FormControl('1212')});
  }

}
